package com.atguigu.yygh.common.config;

import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * ClassName:MybatisPlusConfig
 * Package:com.atguigu.yygh.common.config
 * Description: mybatis-plus配置类
 *
 * @date:2021/7/20 18:22
 * @author:Aimer
 */

@Configuration
@MapperScan("com.atguigu.yygh.hosp.mapper")
@EnableTransactionManagement   //事务处理
public class MybatisPlusConfig {


    //乐观锁配置
    @Bean
    public OptimisticLockerInterceptor getOptimisticLockerInterceptor(){
        return new OptimisticLockerInterceptor();
    }


    //分页插件
    @Bean
    public PaginationInterceptor getPaginationInterceptor(){
        return new PaginationInterceptor();
        //PaginationInterceptor  最大单页限制数量，默认500条，小于0入-1 不受限制
    }



}
